home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: === **ptr QUES ===
- Date: Thu, 18 Apr 96 22:03:48 GMT
- Organization: none
- Message-ID: <829865028snz@genesis.demon.co.uk>
- References: <31767207.167E@cell.co.uk>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <31767207.167E@cell.co.uk> kai@cell.co.uk "Kai Chan" writes:
-
- >Hi,
- > I've got the following code fragment. Question I've got concerns
- >passing the pointer to a pointer to func1, and that is: which is
- >correct?
- >
- >blar...
- >blar...
- >
- >main()
- >{
- > some_type1 **ptr;
- >
- > func1(ptr); /* is this right? */
-
- This is the one that passes a value of the correct type. However when you
- use the value of a variable in C that variable must be set to a well-defined
- value. Here ptr is uninitialised so passing its value as a function argument
- is illegal. So you need to set it to something first, typically a pointer to
- a char * object/variable or element of an array f char * that you want func1
- to access or modify.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-